@extends('admin.conn.main')

@section('css')
    <style>
        .demo-img{
            width: 50px;
            height: 70px;
        }
    </style>
@endsection
@section('content')

<!--页面主要内容-->
<main class="lyear-layout-content">

    <div class="container-fluid">

        <div class="row">
            <div class="col-lg-12">
                <div class="card">
                    <div class="card-toolbar clearfix">
                        <form class="pull-right search-bar" method="get" action="#!" role="form">
                            <div class="input-group">
                                <div class="input-group-btn">
                                    <input type="hidden" name="search_field" id="search-field" value="title">
                                    <button class="btn btn-default dropdown-toggle" id="search-btn" data-toggle="dropdown" type="button" aria-haspopup="true" aria-expanded="false">
                                        标题 <span class="caret"></span>
                                    </button>
                                    <ul class="dropdown-menu">
                                        <li> <a tabindex="-1" href="javascript:void(0)" data-field="title">标题</a> </li>
                                        <li> <a tabindex="-1" href="javascript:void(0)" data-field="cat_name">栏目</a> </li>
                                    </ul>
                                </div>
                                <input type="text" class="form-control" value="" name="keyword" placeholder="请输入名称">
                            </div>
                        </form>
                        <div class="toolbar-btn-action">
                            <a class="btn btn-primary m-r-5" href="#!"><i class="mdi mdi-plus"></i> 新增</a>
                            <a class="btn btn-success m-r-5" href="#!"><i class="mdi mdi-check"></i> 启用</a>
                            <a class="btn btn-warning m-r-5" href="#!"><i class="mdi mdi-block-helper"></i> 禁用</a>
                            <a class="btn btn-danger" href="#!"><i class="mdi mdi-window-close"></i> 删除</a>
                        </div>
                    </div>
                    <div class="card-body">

                        <div class="table-responsive">
                            <table class="table table-bordered">
                                <thead>
                                <tr>
                                    <th width="20">
                                        <label class="lyear-checkbox checkbox-primary">
                                            <input type="checkbox" id="check-all"><span></span>
                                        </label>
                                    </th>
                                    <th width="20">编号</th>
                                    <th>封面</th>
                                    <th>标题</th>
                                    <th width="150">简述</th>
                                    <th width="80">作者</th>
                                    <th width="80">类型</th>
                                    <th>字数量</th>
                                    <th>阅读量</th>
                                    <th>收藏量</th>
                                    <th>状态</th>
                                    <th width="100">更新时间</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                @foreach($data as $v)
                                <tr>
                                    <td>
                                        <label class="lyear-checkbox checkbox-primary">
                                            <input type="checkbox" name="ids[]" value="1"><span></span>
                                        </label>
                                    </td>
                                    <td>{{$v['id']}}</td>
                                    <td><img src="{{$v['cover']}}" alt="" class="demo-img"></td>
                                    <td>{{$v['title']}}</td>
                                    <td>{{$v['content']}}</td>
                                    <td>{{$v['author']}}</td>
                                    <td>{{$v['type']}}</td>
                                    <td>{{$v['number']}}万</td>
                                    <td>{{$v['reading']}}万</td>
                                    <td>{{$v['collection']}}万</td>
                                        <td><font class="text-success">{{$v['status']}}</font></td>
                                    <td>{{$v['created_at']}}</td>
                                    <td>
                                        <div class="btn-group">
                                            <a class="btn btn-xs btn-default" href="#!" title="编辑" data-toggle="tooltip"><i class="mdi mdi-pencil"></i></a>
                                            <a class="btn btn-xs btn-default" href="{{route('admin.article.destroy',['id'=>$v->id])}}" title="删除" data-toggle="tooltip"><i class="mdi mdi-window-close"></i></a>
                                        </div>
                                    </td>
                                </tr>
                                @endforeach
                                </tbody>
                            </table>
                        </div>
                        <div>{{$data->links()}}</div>
                    </div>
                </div>
            </div>

        </div>

    </div>

</main>
@endsection
<!--End 页面主要内容-->
@section('js')
    <script type="text/javascript">
        $(function(){
            $('.search-bar .dropdown-menu a').click(function() {
                var field = $(this).data('field') || '';
                $('#search-field').val(field);
                $('#search-btn').html($(this).text() + ' <span class="caret"></span>');
            });
        });
    </script>
@endsection

